package cn.itcast.bos.service.transit.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.transit.DeliveryInfoRepository;
import cn.itcast.bos.dao.transit.TransitInfoRepository;
import cn.itcast.bos.domain.transit.DeliveryInfo;
import cn.itcast.bos.domain.transit.TransitInfo;
import cn.itcast.bos.service.transit.DeliveryInfoService;

@SuppressWarnings("all")
@Service
@Transactional
public class DeliveryInfoServiceimpl implements DeliveryInfoService{
	
  
	@Autowired
    private DeliveryInfoRepository deliveryInfoRepository;
    
    @Autowired
    private TransitInfoRepository transitInfoRepository;
    
	@Override
	public void save(DeliveryInfo deliveryInfo, String transitInfoId) {
		System.out.println("运输时"+transitInfoId);
		//保存开始配送
	        deliveryInfoRepository.save(deliveryInfo);
	        
	        TransitInfo transitInfo = transitInfoRepository.findOne(Integer.parseInt(transitInfoId));
	        
	        transitInfo.setDeliveryInfo(deliveryInfo);
	        
	        transitInfo.setStatus("开始配送");
	}
       
	
 
}
